/*    */ package com.zhonglee.util;
/*    */ 
/*    */ import java.io.PrintStream;
/*    */ import java.text.DateFormat;
/*    */ import java.text.ParseException;
/*    */ import java.text.SimpleDateFormat;
/*    */ import java.util.Calendar;
/*    */ import java.util.Date;
/*    */ import java.util.logging.Level;
/*    */ import java.util.logging.Logger;
/*    */ 
/*    */ public class TimeUtils
/*    */ {
/*    */   public static String getLongTime(Date date)
/*    */   {
/* 23 */     if (date == null) {
/* 24 */       return null;
/*    */     }
/* 26 */     DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/* 27 */     String result = df.format(date);
/* 28 */     return result;
/*    */   }
/*    */ 
/*    */   public static String getShortTime(Date date) {
/* 32 */     if (date == null) {
/* 33 */       return null;
/*    */     }
/* 35 */     DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
/* 36 */     String result = "";
/* 37 */     result = df.format(date);
/* 38 */     return result;
/*    */   }
/*    */ 
/*    */   public static Date getDate(String sDate) {
/* 42 */     if (sDate == null) {
/* 43 */       return null;
/*    */     }
/* 45 */     DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
/* 46 */     Date date = null;
/*    */     try {
/* 48 */       date = df.parse(sDate);
/*    */     } catch (ParseException ex) {
/* 50 */       Logger.getLogger(TimeUtils.class.getName()).log(Level.SEVERE, null, ex);
/*    */     }
/* 52 */     return date;
/*    */   }
/*    */ 
/*    */   public static Date addDays(Date original, int n) {
/* 56 */     System.out.println("in date:" + getLongTime(original));
/* 57 */     Calendar c = Calendar.getInstance();
/* 58 */     c.setTime(original);
/* 59 */     c.add(6, n);
/* 60 */     System.out.println("out date:" + getLongTime(c.getTime()));
/* 61 */     return c.getTime();
/*    */   }
/*    */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     com.zhonglee.util.TimeUtils
 * JD-Core Version:    0.6.2
 */